package org.thanos.demo.web;

import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.time.LocalDateTime;

@RestController
public class DemoController {

    @GetMapping(value = "/ping")
    public Object ping() {
        return LocalDateTime.now();
    }

    @GetMapping(value = "/request")
    public Object requestList(@RequestHeader(HttpHeaders.AUTHORIZATION) String token) {
        return token;
    }

    @GetMapping(value = "/properties")
    public void properties() throws IOException {
        ClassPathResource classPathResource = new ClassPathResource("aaa/aaa.properties");
        System.out.println(classPathResource.getFile());
    }
}
